home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2214 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1014 b 

  1. Path: news.infi.net!usenet
  2. From: nngis@norfolk.infi.net (Greg DiGiorgio)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: union ?
  5. Date: 19 Jan 1996 13:32:13 GMT
  6. Organization: Customer of InfiNet
  7. Message-ID: <4do6gt$hhr@news.infi.net>
  8. References: <4dkigi$c29@linet02.li.net>
  9. Reply-To: nngis@norfolk.infi.net
  10. NNTP-Posting-Host: h-wastelands.norfolk.infi.net
  11. Mime-Version: 1.0
  12. X-Newsreader: WinVN 0.99.3
  13.  
  14. In article <4dkigi$c29@linet02.li.net>, don@newshost.li.net says...
  15. >
  16. >A union consist of many different variables.
  17. >But at any one time it can only hold one of those variables.
  18. >Is that correct?
  19. >
  20.  
  21. That's correct. A union is an area of shared memory. You define the area 
  22. to be of multiple data types (or variables, if you will). The compiler 
  23. then allocates an area of memory large enough to accommodate that largest 
  24. variable you declared. Then you put data into the union by assigning one 
  25. of the variables a value. Then you can view that value "through the eyes" 
  26. of any of the variables you declared.
  27.  
  28. Greg DiGiorgio
  29.  
  30.